package com.kl.model.base;

import com.kl.constant.TankModel;
import com.kl.enums.Direct;
import com.kl.enums.TankType;
import com.kl.model.pojo.Shoot;

/**
 * @author CC
 * time 2024-05-15
 * description
 */
public class ShootFactory {

    public static Shoot getObject(int x, int y , Direct direct, TankType origin){
        switch (direct) {
            case UP:
                return new Shoot(x,y- TankModel.PIPED_LENGTH,direct,origin);
            case DOWN:
                return new Shoot(x,y+TankModel.PIPED_LENGTH,direct,origin);
            case LEFT:
                return new Shoot(x-TankModel.PIPED_LENGTH,y,direct,origin);
            case RIGHT:
                return new Shoot(x+TankModel.PIPED_LENGTH,y,direct,origin);
        }
        throw new RuntimeException("build shoot error , not support this direction ："+direct);
    }



}
